﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace AppFabricAdministrator
{
    public partial class TestAdd : UserControl
    {
        public TestAdd()
        {
            InitializeComponent();
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            string key = tbKey.Text;
            string value = tbValue.Text;
            if (string.IsNullOrWhiteSpace(key))
            {
                MessageBox.Show("Key name can not be empty");
            }
            else
            {
                var namedCache = TestCache.Current.NamedCacheControl.SelectedNamedCache;
                CacheHelper.GetNamedCache(namedCache).Add(key, value);
                TestCache.Current.PublishResult("Key {0} added successfully in Namedcache {1}", key, namedCache);
            }
        }
    }
}
